﻿@using MvcDeviceManager.Models
@using System.Web.Optimization
@helper treeMenu(IList<Menu> list)
{
    foreach (MvcDeviceManager.Models.Menu menu in list)
    {
        <li>
        @if (menu.Children!=null && menu.Children.Count > 0)
        {
            <a href="javascript:void(0)">@menu.MenuName</a>
            <ul>
            @foreach (MvcDeviceManager.Models.Menu menu1 in menu.Children)
            {
                <li>
                    <a href="@Url.Content(@menu1.Url)">@menu1.MenuName</a>
                </li>
            }
           
            </ul>
        }else{
             <a href="@Url.Content(@menu.Url)">@menu.MenuName</a>
        }
        </li> 
    }
}
<html>

<head>
    <title>@ViewBag.Title</title>
    <script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
    @Styles.Render("~/Content/css")
    <script src="@Url.Content("~/Scripts/jquery.hoveraccordion.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            resizeMenu();
            $(window).bind("resize", resizeMenu);
            $('#menu').hoverAccordion({
                //                keepHeight: true,
                activateItem: 1, 
                onClickOnly: true
            });
        });
        function resizeMenu() {
            var doc = $(document).height();
            var header = $('#header').height();
            var bottom = $('#bottom').height();
            $('#menu').height(doc - header - bottom);
        }
    </script>
</head>
<body>
    <div id="header">
        header
        <div style="float:right;">@Html.ActionLink("注销","LogOut","Login")</div>
    </div>
    <div>
        <ul id="menu">
        @treeMenu((IList<Menu>)@Session["menu"])
        </ul>
        <div>
        
        </div>
        <div style="clear:both;"></div>
    </div>
    <div id="bottom">
        bottom
    </div>
</body>
</html>
